package com.houxy.controller;

import com.houxy.repository.model.entity.Department;
import com.houxy.repository.model.entity.Hospital;
import com.houxy.service.DepartmentService;
import com.houxy.service.HospitalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

/**
 * @author houxy
 * @date 2018/11/1 12:30
 * @describe：
 */
@Controller
@RequestMapping("/index")
public class IndexContrller {

    @Autowired
    private HospitalService hospitalService;

    @Autowired
    public DepartmentService departmentService;

    @RequestMapping("/index")
    public String index(HttpSession session) {
        List<Hospital> hospitalList = hospitalService.findAll();
        List<Department> departmentList = departmentService.findAllDepartment();
        session.setAttribute("hospitalList", hospitalList);
        session.setAttribute("departmentList", departmentList);
        return "front/search/experSearch";

    }

}
